package com.caine.web.controller;

import com.caine.web.service.ITestService01;
import com.caine.web.service.ITestService02;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @Author: CaineZhu
 * @Description:
 * @Date: Created in 15:49 2020/12/17
 * @Modified By:
 */
@Slf4j
@RestController
public class TestController {

    @Autowired
    private ITestService01 service01;
    @Autowired
    private ITestService02 service02;

    @RequestMapping("deallock01")
    public Map<String, Object> deallock01() {
        service01.lock01();
        Map<String, Object> retMap = new HashMap<>();
        retMap.put("deallock01 currentTime:", System.currentTimeMillis() + "");
        return retMap;
    }

    @RequestMapping("deallock02")
    public Map<String, Object> deallock02() {
        service01.lock02();
        Map<String, Object> retMap = new HashMap<>();
        retMap.put("deallock02 currentTime:", System.currentTimeMillis() + "");
        return retMap;
    }

    @RequestMapping("nolock")
    public Map<String, Object> nolock() {
        service01.nolock();
        Map<String, Object> retMap = new HashMap<>();
        retMap.put("nolock currentTime:", System.currentTimeMillis() + "");
        return retMap;
    }
}
